package com.example.ordersystem.domain;

import java.io.File;
import java.io.Serializable;

/**
 * lineiteminfo作为视图,存放在mysql数据库中
 */
public class LineitemInfo implements Serializable {
    public static final String PICTURE_PATH = "/DishPictures";

    /**订单编号*/

    private String orderNum;

    /**
     * 菜品名称
     */

    private String dName;

    /**
     * 菜品编号
     */

    private int dNum;

    /**
     * 菜品图片
     */

    private String picture;

    /**
     * 菜品单价
     */

    private int price;

    /**
     * 订购数量
     */

    private int quantity;

    /**
     * 订单项金额
     */

    private int amount;

    public LineitemInfo() {
    }

    public LineitemInfo(int dNum, String dName, String picture, int price, int quantity) {
        this.dNum = dNum;
        this.dName = dName;
        this.picture = picture;
        this.price = price;
        this.quantity = quantity;
        this.amount = this.price * this.quantity;
    }

    public String getDisplayPicture() {
        return PICTURE_PATH.concat(File.separator).concat(picture);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof LineitemInfo) {
            LineitemInfo item = (LineitemInfo) obj;
            return this.dNum == item.dNum;
        }
        return false;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public String getdName() {
        return dName;
    }

    public void setdName(String dName) {
        this.dName = dName;
    }

    public int getdNum() {
        return dNum;
    }

    public void setdNum(int dNum) {
        this.dNum = dNum;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }
}
